<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>代理用户详情</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="/resource/layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="/resource/css/mylay.css">
		<link rel="stylesheet" href="./layui/layui/css/layui.css">
		<link rel="stylesheet" href="/resource/css/kpi_list.css">
		</link>
	</head>

	<body>
		<div class="all">
			<!-- 表单元素 -->
			<div id="" style="margin-top: 10px;">
				<button type="button" class="layui-btn" id="layui-btn1" onclick="javascript:window.history.back();">返回</button>
			</div>
			<div class="layui-tab">
				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show DaiLiYongHu">
						<div style="padding: 20px; background-color: #F2F2F2;">
							<div class="layui-row layui-col-space15">
								<div class="layui-col-md12">
									<div class="layui-card" style="padding: 10px;">
										<form class="layui-form search">
											<div class="layui-form-item">
												<div class="layui-inline">
													<label class="layui-form-label">账号</label>
													<div class="layui-input-inline">
														<input class="layui-input" name="account" autocomplete="off">
													</div>
												</div>
												<div class="layui-inline">
													<label class="layui-form-label">注册时间</label>
													<div class="layui-input-inline">
														<input class="layui-input" id="datetimeRange"
															name="datetimeRange" autocomplete="off">
													</div>
												</div>
												<div class="layui-form-mid" id="user">等级</div>
												<div class="layui-input-inline" style="width: 100px;">
													<select name="level" lay-verify="" id="selete">
														<option value="0">全部</option>
														<option value="1">LV1</option>
														<option value="2">LV2</option>
														<option value="3">LV3</option>
														<option value="4">LV4</option>
														<option value="5">LV5</option>
														<option value="6">LV6</option>
														<option value="7">LV7</option>
													</select>
												</div>
												<div class="layui-inline" style="text-align: center;">
													<button type="button" class="layui-btn" id="layui-btn1"
														data-type="search">搜索</button>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
						</div>
						<table id="DaiLiYongHu" lay-filter="DaiLiYongHu"></table>
						<script type="text/html" id="personageOperation">
							<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="grant">发放</a>
							<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="refused">拒绝</a>
						</script>
					</div>

				</div>
			</div>
		</div>
		<script src="/resource/layuiadmin/layui/layui.js"></script>
		<script src="/resource/js/manage/init_date.js"></script>
		<script src="/manage/user.js"></script>
		<script src="./layui/layui/layui.js"></script>
		<script>
			//获取ID
			window.onload = function() {
				var usernameID = window.location.search.substring(4)
				console.log('onload',usernameID)
				//注意：选项卡 依赖 element 模块，否则无法进行功能性操作
				layui.use(['element', 'table', 'form'], function() {
					var form = layui.form;
					var element = layui.element;
					var $ = layui.$;
					var table = layui.table;
					var laydate = layui.laydate;
					laydate.render({
						elem: '#datetimeRange',
						type: 'datetime',
						range: true
					});
					//-----------------------个人
					table.render({
						elem: '#DaiLiYongHu',
						title: "代理商用户详情",
						url: '/manage/useragent/agentUsersDetail?id='+usernameID,
						method: 'post',
						cols: [
							[
								//表头
								{
									field: 'username',
									title: '用户账户'
								},
								{
									field: 'upper',
									title: '上级'
								},
								{
									field: 'vip_level',
									title: '等级'
								},
								{
									field: 'reg_time',
									title: '注册时间'
								},
								{
									field: 'total_recharge',
									title: '充值总额'
								},
								{
									field: 'total_withdrawals',
									title: '提现总额'
								},
								{
									field: 'balance',
									title: '账户余额'
								},
								{
									field: 'total_recharge',
									title: '充值总额'
								},
								{
									field: 'total_withdrawals',
									title: '提现总额'
								},
								{
									field: 'balance',
									title: '当前用户余额'
								},
								{
									field: 'total_tasks',
									title: '任务数'
								},
								{
									field: 'total_task_amount',
									title: '任务总额'
								},
								{
									field: 'user_person_reward',
									title: '用户业绩奖励总额'
								},
								{
									field: 'reward_value',
									title: '团队业绩奖励总额'
								},
								{
									field: 'level_reward',
									title: '级差奖励总额'
								}
							]
						],
						cellMinWidth: 100,
						toolbar: '#toolbarDemo',
						defaultToobar: ["filter", 'print', 'exports'],
						totalRow: true,
						page: {
							layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
						},
						skin: 'row' //行边框风格
							,
						even: true //开启隔行背景
				
					});
					active1 = {
						search: function() {
							console.log('搜索')
							//执行重载
							table.reload('DaiLiYongHu', {
								page: {
									curr: 1 //重新从第 1 页开始
								},
								where: {
									username: $("input[name='account']").val(),
									level: $("select[name='level'] option:selected").val(),
									datetime_range: $("input[name='datetimeRange']").val(),
								}
							}, 'data');
						}
					};
				
					$('.DaiLiYongHu #layui-btn1').on('click', function() {
						var type = $(this).data('type');
						active1[type] ? active1[type].call(this) : '';
					});
				});
			}
		</script>
	</body>
</html>
